@extends('layouts.admin-app')

@section('content')

    <div class="contentpanel panel-email">
        <div class="box">
            @include('admin.partials.errors')
            @include('admin.partials.success')
        </div>

        <div class="row">

            <div class="col-sm-9 col-lg-12">

                <h5 class="subtitle mb5">{{ $type==1 ? '住院部' : '居家观察' }}</h5>
                <div class="panel panel-default">
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-sm-9 text-xs-center" id='element_id'>
                                {{--<form action="{{ route('admin.school.index') }}" method="post">--}}
                                <form action="{{ $type==1 ? url('admin/zhuyuan/index') : url('admin/jujia/index') }}" method="post">
                                    {{csrf_field()}}
                                    {{--<input type="hidden" name="_method" value="get">--}}
                                    <input type="hidden" name="type" value="{{ $type }}">
                                    <input id="demo-foo-search" type="text" placeholder="名称搜索" class="form-control" autocomplete="off" name="name" value="{{$search['name'] or ''}}" style="width: auto;display: inline">
                                    &nbsp;&nbsp;&nbsp;
                                    <select class="classType form-control" name="bingqu_id" style="width: auto;display: inline">
                                        <option  value="0">请选择病区</option>
                                        @foreach($bingqu as $v)
                                            <option value="{{$v->id}}" {{ ($v->id==$search['bingqu_id'])?'selected':'' }} >{{$v->name}}</option>
                                        @endforeach
                                    </select>
                                    <button class="btn btn-primary">搜索</button>
                                    <a class="btn btn-primary" href="{{$type==1 ? url('admin/zhuyuan/index') : url('admin/jujia/index') }}">清空查询</a>
                                </form>
                            </div>

                            <div class="col-md-3 text-right">
                                <a href="{{ route('admin.bingren.create').'?type='.$type }}" class="btn btn-success btn-md"><i class="fa fa-plus-circle"></i> 新增 </a>
                            </div>
                        </div>


                        <div class="table-responsive col-md-12">
                            <table class="table mb30">
                                <thead>
                                <tr>
                                    <th>#</th>
                                    <th>姓名</th>
                                    <th>病区</th>
                                    <th>病床号</th>
                                    <th>设备编号</th>
                                    <th>体温</th>
                                    <th>血氧饱和度</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($data as $v)
                                    <tr class="{{ $v->is_hot ? 'text-danger' : ''}}">
                                        <td>{{ $v->id }}</td>
                                        <td>{{ $v->name }}</td>
                                        <td>{{ $v->get_bingqu->name }}</td>
                                        <td>{{ $v->get_bingchuang->code }}</td>
                                        <td>{{ $v->shebei_code }}</td>
                                        <td>{{ $v->tiwen }}</td>
                                        <td>{{ $v->xueyang }}</td>
                                        <td>
                                            <a href="{{ route('admin.bingren.tiwen',['id'=>$v->id]) }}" class="btn btn-white btn-xs"><i class="fa fa-pencil"></i> 查看体温</a>
                                            <a href="{{ route('admin.bingren.edit',['id'=>$v->id]) }}" class="btn btn-white btn-xs"><i class="fa fa-pencil"></i> 编辑</a>
                                            <a href="{{ route('admin.bingren.jiechu',['id'=>$v->id]) }}" class="btn btn-white btn-xs"><i class="fa fa-pencil"></i> 解除</a>
                                            {{--<a class="btn btn-danger btn-xs user-delete" data-href="{{ route('admin.bingren.destroy',['id'=>$v->id]) }}"> <i class="fa fa-trash-o"></i> 删除</a>--}}
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>

                        {!! $data->render() !!}

                    </div><!-- panel-body -->
                </div><!-- panel -->

            </div><!-- col-sm-9 -->

        </div><!-- row -->

    </div>
@endsection

@section('javascript')
    @parent
    <script src="{{ asset('js/ajax.js') }}"></script>
    <script type="text/javascript">
//        $(".user-delete").click(function () {
//            Rbac.ajax.delete({
//                confirmTitle: '确定删除用户?',
//                href: $(this).data('href'),
//                successTitle: '用户删除成功'
//            });
//        });

    </script>

@endsection
